<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>九亩点菜系统</title>
<meta http-equiv="MSThemeCompatible" content="Yes" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/style_2_common.css?BPm" />
<script src="__PUBLIC__/js/common.js" type="text/javascript"></script>
<link href="__PUBLIC__/css/style.css" rel="stylesheet" type="text/css" />
 <script src="__PUBLIC__/js/jquery-1.4.2.min.js" type="text/javascript"></script>
<!--script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak={:$apikey}"></script-->
 <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/cymain.css" />
 <script src="__PUBLIC__/js/artDialog/jquery.artDialog.js?skin=default"></script>
<script src="__PUBLIC__/js/artDialog/plugins/iframeTools.js"></script>
</head>
<body style="background:#fff">
<php>if(!isset($_GET['error'])){</php>
<div></div>
<div style="background:#fefbe4;border:1px solid #f3ecb9;color:#993300;padding:10px;width:90%;margin:40px auto 5px auto;">选中文件后点击上传按钮</div>
<form enctype="multipart/form-data" action="" id="thumbForm" method="POST" style="font-size:14px;padding:30px 20px 10px 20px;">
	<p id="picsize" style="margin-bottom:20px"></p>
	<p>
		<div>
			<div style="font-size:14px;">选择本地文件：<br><br>
				<input type="file" style="width:80%;border:1px solid #ddd" name="photo"></input>
			</div>
			<div style="padding:20px 0;text-align:center;">
				<input type="hidden" name="cate" id="cate" value="{$cate}">
				<input id="submitbtn" name="doSubmit" type="submit" class="btnGreen" value="上传" onclick="this.value='上传中...'"></input> 					<!--input name="btnchoose" onclick="location.href='{:U('Attachment/my',array('type'=>'my'))}'" type="button" class="btnGreen" value="从素材库选择" /-->
			</div>
	</p>
	<input type="hidden" value="" id="width" name="width" />
	<input type="hidden" value="" id="height" name="height" />
</form>
<script>
    var origin = artDialog.open.origin;
if (art.dialog.data('width')) {
    var getid = origin.document.getElementsByName('radios');
    if(getid && art.dialog.data('domid')=='radiobg'){
        for(var i=0;i<getid.length;i++){
            if(getid[i].checked){
                if(getid[i].value == 1){
                    $('#picsize').html('<span style="color:#930; font-size:14px;margin-bottom:20px;">图片最佳尺寸：宽640px 高400px</span>');
                } else if(getid[i].value == 2){
                    $('#picsize').html('<span style="color:#930; font-size:14px;margin-bottom:20px;">图片最佳尺寸：宽640px 高1008px</span>');
                }else{
                    $('#picsize').html('<span style="color:#930; font-size:14px;margin-bottom:20px;">图片最佳尺寸：宽640px 高180px</span>');
                }

            }
        }
        //alert(getid.length);
    }else{
        document.getElementById('width').value = art.dialog.data('width');// 获取由主页面传递过来的数据
        document.getElementById('height').value = art.dialog.data('height');
        if(document.getElementById('height').value){
            $('#picsize').html('<span style="color:#930; font-size:14px;margin-bottom:20px;">图片最佳尺寸：宽'+document.getElementById('width').value+'px 高'+document.getElementById('height').value+'px</span>');
        }else{
            $('#picsize').html('<span style="color:red; font-size:14px;margin-bottom:20px;">图片宽高不限</span>');
        }
    }

};
</script>
<php>}else{</php>
<div style="text-align:center;line-height:140px;font-size:14px;"> <img src="__PUBLIC__/images/export.png" align="absmiddle" /> <php>if($_GET['error']==0){echo '上传成功';}else{echo $_GET['msg'];}</php> </div>
<script>
var domid=art.dialog.data('domid');
// 返回数据到主页面
function returnHomepage(url){
	var url1 = url.replace(/ptth/g, "http:");
	var url2 = url1.replace(/xgxg/g, "/");
	var origin = artDialog.open.origin;
	var dom = origin.document.getElementById(domid);
    var dom_head = origin.document.getElementsByName('radios');
    for(var i = 1;i <= dom_head.length;i++){
        if(origin.document.getElementById('radiov'+i).checked && domid == 'touxiang'){
            origin.document.getElementById('head'+i).src=url2;
            break;
        }
        if(origin.document.getElementById('radiov'+i).checked && domid == 'radiobg'){
            origin.document.getElementById('backbg'+i).src=url2;
            origin.document.getElementById('backbg'+i).style.display='block';
            break;
        }
    }
	var domsrcid=domid+'_src';
	if(origin.document.getElementById(domsrcid)){
		origin.document.getElementById(domsrcid).src=url2;
	}
	dom.value=url2;
	setTimeout("art.dialog.close()", 1500 )
}
<php>if($_GET['error']==0){</php>
returnHomepage('<php>echo $_GET['msg'];</php>');
<php>}</php>
</script>
<php>}</php>
</body>
</html>